pub fn add(left: usize, right: usize) -> usize {
    left + right
}


#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn it_works() {
        let result = add(2, 2);
        assert_eq!(result, 4);
    }

    #[test]
    #[should_panic]
    fn test2() {
        // panic!("err");
        assert_eq!(2 + 3, 4, "这玩意不等啊！{}", 4);
    }

    #[test]
    #[should_panic]
    fn test3() {
        panic!("如果出现异常，才是正常")
    }


    #[test]
    fn test4() -> Result<(), String> {
        if 1 + 3 == 4 {
            Ok(())
        } else {
            Err("error".to_string())
        }
    }

    #[test]
    fn test4_1(){
       let r  = test4();
        if r.is_ok() {
            assert!(r.is_ok(),"it's ok")
        }
    }
}
